<?php
/*
@Script: Captura informações do browser do usuário
@Projeto: Hypnobox
@Autor: Matheus Biagini
@Obs: Captura informações do browser do usuário de acordo com a diretiva browscap.ini
*/
class ClientInfo
{
	private $__platform;
	private $__platform_version;
	private $__browser;
	private $__version;
	private $__majorver;
	private $__minorver;
	private $__backgroundsounds;
	private $__cookies;
	private $__javascript;
	private $__javaapplets;
	private $__cssversion;
	private $__vbscript;
	private $__activexcontrols;
	private $__ismobiledevice;
	private $__istablet;
	private $__aolversion;
	
	private $__browserArray;
	private $__ServidorName;
	private $__ServidorIP;
	private $__ServidorProtocol;
	private $__ip;
	
	
	public function __construct()
	{
		$this->Inicializar();	
	}
	
	public function Inicializar()
	{
		/*@Browser informações*/
		$this->setInfoClient();
		@setcookie("valida_cookie", true);
		
		/*@Propriedades*/
		$this->pServidorName($_SERVER['SERVER_NAME']);
		$this->pServidorIP($_SERVER['SERVER_ADDR']);
		$this->pServidorProtocol($_SERVER['SERVER_PROTOCOL']);
		$this->pIP($_SERVER['REMOTE_ADDR']);
		$this->pPlatform($this->__browserArray->platform);
		$this->pPlatformVersion($this->__browserArray->platform_version);
		$this->pBrowser($this->__browserArray->browser);
		$this->pBrowserVersion($this->__browserArray->version);
		$this->pMajorver($this->__browserArray->majorver);
		$this->pMinorver($this->__browserArray->minorver);
		$this->pBackgroundsounds($this->__browserArray->backgroundsounds);
		$this->pCookies($this->VerificaCookie());
		$this->pJavascript($this->__browserArray->javascript);
		$this->pJavaapplets($this->__browserArray->javaapplets);
		$this->pCssversion($this->__browserArray->cssversion);
		$this->pVbscript($this->__browserArray->vbscript);
		$this->pActivexcontrols($this->__browserArray->activexcontrols);
		$this->pIsmobiledevice($this->__browserArray->ismobiledevice);
		$this->pIstablet($this->__browserArray->istablet);
		$this->pAolversion($this->__browserArray->aolversion);
	}
	
	private function setInfoClient()
	{
		$this->__browserArray = get_browser();	
	}
	
	public function getInfoClient()
	{
		return $this->__browserArray;
	}
	
	public function pServidorName($val = "")
	{
		if($val == ""){
			return $this->__ServidorName;
		}else{
			$this->__ServidorName = $val;	
		}	
	}
	
	public function pServidorIP($val = "")
	{
		if($val == ""){
			return $this->__ServidorIP;
		}else{
			$this->__ServidorIP = $val;	
		}	
	}
	
	public function pServidorProtocol($val = "")
	{
		if($val == ""){
			return $this->__ServidorProtocol;
		}else{
			$this->__ServidorProtocol = $val;	
		}	
	}
	
	public function pIP($val = "")
	{
		if($val == ""){
			return $this->__ip;
		}else{
			$this->__ip = $val;	
		}
	}
	
	public function pPlatform($val = "")
	{
		if($val == ""){
			return $this->__platform;
		}else{
			$this->__platform = $val;	
		}
	}
	
	public function pPlatformVersion($val = "")
	{
		if($val == ""){
			return $this->__platform_version;
		}else{
			$this->__platform_version = $val;	
		}
	}
	
	public function pBrowser($val = "")
	{
		if($val == ""){
			return $this->__browser;
		}else{
			$this->__browser = $val;	
		}
	}
	
	public function pBrowserVersion($val = "")
	{
		if($val == ""){
			return $this->__version;
		}else{
			$this->__version = $val;	
		}
	}
	
	public function pMajorver($val = "")
	{
		if($val == ""){
			return $this->__majorver;
		}else{
			$this->__majorver = $val;	
		}
	}
	
	public function pMinorver($val = "")
	{
		if($val == ""){
			return $this->__minorver;
		}else{
			$this->__minorver = $val;	
		}
	}
	
	public function pBackgroundsounds($val = "")
	{
		if($val == ""){
			return $this->__backgroundsounds;
		}else{
			$this->__backgroundsounds = $val;	
		}
	}
	
	public function pCookies($val = "")
	{
		if($val == ""){
			return $this->__cookies;
		}else{
			$this->__cookies = $val;	
		}
	}
	
	public function pJavascript($val = "")
	{
		if($val == ""){
			return $this->__javascript;
		}else{
			$this->__javascript = $val;	
		}
	}
	
	public function pJavaapplets($val = "")
	{
		if($val == ""){
			return $this->__javaapplets;
		}else{
			$this->__javaapplets = $val;	
		}
	}
	
	public function pCssversion($val = "")
	{
		if($val == ""){
			return $this->__cssversion;
		}else{
			$this->__cssversion = $val;	
		}
	}
	
	public function pVbscript($val = "")
	{
		if($val == ""){
			return $this->__vbscript;
		}else{
			$this->__vbscript = $val;	
		}
	}
	
	public function pActivexcontrols($val = "")
	{
		if($val == ""){
			return $this->__activexcontrols;
		}else{
			$this->__activexcontrols = $val;	
		}
	}
	
	public function pIsmobiledevice($val = "")
	{
		if($val == ""){
			return $this->__ismobiledevice;
		}else{
			$this->__ismobiledevice = $val;	
		}
	}
	
	public function pIstablet($val = "")
	{
		if($val == ""){
			return $this->__istablet;
		}else{
			$this->__istablet = $val;	
		}
	}
	
	public function pAolversion($val = "")
	{
		if($val == ""){
			return $this->__aolversion;
		}else{
			$this->__aolversion = $val;	
		}
	}
	
	public function getBrowser(){
		return $_SERVER['HTTP_USER_AGENT'];	
	}
	
	public function VerificaCookie(){
		if($_COOKIE['valida_cookie'] == true){
			return true;
		}else{
			return false;	
		}	
	}
}
?>